package com.nageoffer.aicloud.utils;

import com.nageoffer.aicloud.common.database.SecurityUserDetails;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * security 工具类
 */
public class SecurityUtil {
    /**
     * 从 security detail 中获取当前用户信息
     */
    public static SecurityUserDetails getUserDetails() {
        return (SecurityUserDetails) SecurityContextHolder
                .getContext()
                .getAuthentication()
                .getPrincipal();
    }
}
